/*    */ package com.zimbra.cs.dav.service.method;
/*    */ 
/*    */ import com.zimbra.cs.dav.DavContext;
/*    */ import com.zimbra.cs.dav.DavException;
/*    */ import com.zimbra.cs.dav.resource.Collection;
/*    */ import com.zimbra.cs.dav.resource.DavResource;
/*    */ import com.zimbra.cs.dav.resource.UrlNamespace;
/*    */ import com.zimbra.cs.dav.service.DavMethod;
/*    */ import com.zimbra.cs.servlet.ETagHeaderFilter;
/*    */ import java.io.IOException;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class Put
/*    */   extends DavMethod
/*    */ {
/*    */   public static final String PUT = "PUT";
/*    */   
/*    */   public String getName()
/*    */   {
/* 37 */     return "PUT";
/*    */   }
/*    */   
/*    */   public void handle(DavContext ctxt) throws DavException, IOException
/*    */   {
/* 42 */     String user = ctxt.getUser();
/* 43 */     String name = ctxt.getItem();
/*    */     
/* 45 */     if ((user == null) || (name == null)) {
/* 46 */       throw new DavException("invalid uri", 406, null);
/*    */     }
/* 48 */     Collection col = UrlNamespace.getCollectionAtUrl(ctxt, ctxt.getPath());
/* 49 */     DavResource rs = col.createItem(ctxt, name);
/* 50 */     if (rs.isNewlyCreated()) {
/* 51 */       ctxt.setStatus(201);
/*    */     } else
/* 53 */       ctxt.setStatus(204);
/* 54 */     if (rs.hasEtag()) {
/* 55 */       ctxt.getResponse().setHeader("ETag", rs.getEtag());
/* 56 */       ctxt.getResponse().setHeader(ETagHeaderFilter.ZIMBRA_ETAG_HEADER, rs.getEtag());
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/dav/service/method/Put.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */